<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:fmt="http://java.sun.com/jstl/fmt"
      xmlns:sf="http://www.springframework.org/tags/faces"
      xmlns:spring="http://www.springframework.org/tags" >

  <head>

    <c:set scope="page" var="defaultRole" value="Yes" />
    <c:forEach items="${sessionScope.SPRING_SECURITY_CONTEXT.authentication.authorities}" var="role" >

        <c:choose>
            <c:when test="${role == 'ROLE_LDAP_TEACHER'}">
                <c:set scope="page" var="defaultRole" value="No"  />
                <meta http-equiv="Refresh" content="0; URL=flow/teacher"/>
            </c:when>

            <c:when test="${role == 'ROLE_LDAP_STUDENT'}">
                <c:set scope="page" var="defaultRole" value="No"  />
                <meta http-equiv="Refresh" content="0; URL=flow/student"/>
            </c:when>

        </c:choose>
    </c:forEach>
    
    <c:if test="${defaultRole == 'Yes'}">
        <meta http-equiv="Refresh" content="0; URL=/login.xhtml"/>
    </c:if>
      
  </head>

</html>

